package loja.view.editor.components.panel;

import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.border.TitledBorder;

import loja.model.entity.produto.Grupo;
import loja.model.handler.HandlerViewEntity;
import loja.view.editor.components.label.LabelIdProperty;
import loja.view.editor.components.textfield.TextFieldProperty;

public class GrupoPanelEditor extends EntityPanelEditor<Grupo, Integer> {

	private JLabel lblId;
	private JLabel lblNome;
	private LabelIdProperty lblIdGrupo;
	private TextFieldProperty txtNome;

	public GrupoPanelEditor(HandlerViewEntity<Grupo, Integer> handlerViewEntity) {

		super(handlerViewEntity);
		lblId = new JLabel("ID");
		lblNome = new JLabel("NOME");
		lblIdGrupo = new LabelIdProperty("idGrupo");
		txtNome = new TextFieldProperty("nome");
	}

	private static final long serialVersionUID = 1L;

	@Override
	public void onStart() {

		setBorder(new TitledBorder("Grupo"));

		txtNome.setPreferredSize(new Dimension(150, 23));

		add(lblId, "split 2");
		add(lblIdGrupo, "wrap");
		add(lblNome, "wrap");
		add(txtNome, "growx, wrap");

		handlerViewEntity.addPropertyView(lblIdGrupo);
		handlerViewEntity.addPropertyView(txtNome);

		addComponentEditor(txtNome);
		addComponentEditor(lblIdGrupo);

		super.onStart();
	}

}
